//
//  HotelMapController.swift
//  AirTravel
//
//  Created by apple on 2021/7/23.
//

import UIKit
import CoreLocation
import MapKit

class HotelMapController: UIViewController {
    
    /// 导航
    @IBOutlet weak var navigationBtn: UIButton!
    @IBOutlet weak var addressLab: UILabel!
    /// 预定
    @IBOutlet weak var reservationBtn: UIButton!
    @IBOutlet weak var titlelab: UILabel!
    @IBOutlet weak var bottomView: UIView!
    @IBOutlet weak var backView: UIView!
//    var mapView: MAMapView!
//    var annotations: Array<MAPointAnnotation>!
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.isNavigationBarHidden = false
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
//        mapView.addAnnotations(annotations)
//        mapView.showAnnotations(annotations, animated: true)
//        mapView.selectAnnotation(annotations.first!, animated: true)
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        self.title = "地图"
        self.bottomView.layer.cornerRadius = 6
        self.bottomView.layer.masksToBounds = true
        self.navigationBtn.layer.cornerRadius = 45/2
        self.navigationBtn.layer.masksToBounds = true
        
        self.reservationBtn.layer.cornerRadius = 45/2
        self.reservationBtn.layer.borderWidth = 1
        self.reservationBtn.layer.borderColor = UIColor(red: 255.0 / 255.0, green: 138.0 / 255.0, blue: 0.0 / 255.0, alpha: 1.0).cgColor
//        initMapView()
//        initAnnotations()
    }

//    func initMapView() {
//        mapView = MAMapView(frame: self.backView.bounds)
//        mapView.delegate = self
//        mapView.setZoomLevel(14, animated: true)
//        self.backView.addSubview(mapView)
//    }
    
//    func initAnnotations() {
//        annotations = Array()
//
//        let coordinates: [CLLocationCoordinate2D] = [
//            CLLocationCoordinate2D(latitude: 39.992520, longitude: 116.336170)]
//
//        for (idx, coor) in coordinates.enumerated() {
//            let anno = MAPointAnnotation()
//            anno.coordinate = coor
//            anno.title = String(idx)
//
//            annotations.append(anno)
//        }
//
//    }
}

//extension HotelMapController:MAMapViewDelegate{
//    //MARK: - MAMapViewDelegate
//
//    func mapView(_ mapView: MAMapView!, viewFor annotation: MAAnnotation!) -> MAAnnotationView! {
//
//        if annotation.isKind(of: MAPointAnnotation.self) {
//            let pointReuseIndetifier = "pointReuseIndetifier"
//            var annotationView: MAPinAnnotationView? = mapView.dequeueReusableAnnotationView(withIdentifier: pointReuseIndetifier) as? MAPinAnnotationView
//
//            if annotationView == nil {
//                annotationView = MAPinAnnotationView(annotation: annotation, reuseIdentifier: pointReuseIndetifier)
//            }
//
//            annotationView!.canShowCallout = true
//            annotationView!.animatesDrop = true
//            annotationView!.isDraggable = true
//            annotationView!.rightCalloutAccessoryView = UIButton(type: UIButton.ButtonType.detailDisclosure)
//
//            let idx = annotations.index(of: annotation as! MAPointAnnotation)
//            annotationView!.pinColor = MAPinAnnotationColor(rawValue: idx! % 3)!
//
//            return annotationView!
//        }
//
//        return nil
//    }
//}
